

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=dark>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/deng-2022/blog_2/img/fluid.png">
  <link rel="icon" href="/deng-2022/blog_2/img/icon/dw.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Memory">
  <meta name="keywords" content="">
  
    <meta name="description" content="🥪 基于自身实践，总结Nginx学习使用过程中的经验">
<meta property="og:type" content="article">
<meta property="og:title" content="Nginx 入门指南：理解、配置和优化">
<meta property="og:url" content="https://atomgit.com/deng-2022/blog_2/2023/06/22/Nginx%20%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97%EF%BC%9A%E7%90%86%E8%A7%A3%E3%80%81%E9%85%8D%E7%BD%AE%E5%92%8C%E4%BC%98%E5%8C%96/index.html">
<meta property="og:site_name" content="Memory&#39;s blog">
<meta property="og:description" content="🥪 基于自身实践，总结Nginx学习使用过程中的经验">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://atomgit.com/deng-2022/blog_2/img/artical/town2.jpg">
<meta property="article:published_time" content="2023-06-22T02:04:32.000Z">
<meta property="article:modified_time" content="2023-12-15T04:56:34.000Z">
<meta property="article:author" content="Memory">
<meta property="article:tag" content="经验">
<meta property="article:tag" content="Nginx">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://atomgit.com/deng-2022/blog_2/img/artical/town2.jpg">
  
  
  
  <title>Nginx 入门指南：理解、配置和优化 - Memory&#39;s blog</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/deng-2022/blog_2/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/deng-2022/blog_2/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/deng-2022/blog_2/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"atomgit.com","root":"/deng-2022/blog_2/","version":"1.9.4","typing":{"enable":true,"typeSpeed":100,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":false,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/deng-2022/blog_2/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/deng-2022/blog_2/js/utils.js" ></script>
  <script  src="/deng-2022/blog_2/js/color-schema.js" ></script>
  

  

  

  

  

  

  

  



  
<meta name="generator" content="Hexo 5.4.2"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 75vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/deng-2022/blog_2/">
      <strong>Memory&#39;s blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/deng-2022/blog_2/links/">
                <i class="iconfont icon-link-fill"></i>
                <span>友链</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/deng-2022/blog_2/img/newBG/girl.jpg') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Nginx 入门指南：理解、配置和优化"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        Memory
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-06-22 10:04" pubdate>
          2023年6月22日 上午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          3.2k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          9 分钟
        
      </span>
    

    
    
      
        <span id="leancloud-page-views-container" class="post-meta" style="display: none">
          <i class="iconfont icon-eye" aria-hidden="true"></i>
          <span id="leancloud-page-views"></span> 次
        </span>
        
      
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar category-bar" style="margin-right: -1rem">
    





<div class="category-list">
  
  
    
    
    
    <div class="category row nomargin-x">
      <a class="category-item 
          list-group-item category-item-action col-10 col-md-11 col-xm-11" title="Nginx"
        id="heading-62e0b5b350c9e3d2c19aa801d9442ba9" role="tab" data-toggle="collapse" href="#collapse-62e0b5b350c9e3d2c19aa801d9442ba9"
        aria-expanded="true"
      >
        Nginx
        <span class="list-group-count">(1)</span>
        <i class="iconfont icon-arrowright"></i>
      </a>
      
      <div class="category-collapse collapse show" id="collapse-62e0b5b350c9e3d2c19aa801d9442ba9"
           role="tabpanel" aria-labelledby="heading-62e0b5b350c9e3d2c19aa801d9442ba9">
        
        
          
          
  <div class="category-post-list">
    
    
  </div>

          
  
    
    
    
    <div class="category-sub row nomargin-x">
      <a class="category-subitem 
          list-group-item category-item-action col-10 col-md-11 col-xm-11" title="经验"
        id="heading-32a8e000e928e6dc255876d9fc0178b3" role="tab" data-toggle="collapse" href="#collapse-32a8e000e928e6dc255876d9fc0178b3"
        aria-expanded="true"
      >
        经验
        <span class="list-group-count">(1)</span>
        <i class="iconfont icon-arrowright"></i>
      </a>
      
      <div class="category-collapse collapse show" id="collapse-32a8e000e928e6dc255876d9fc0178b3"
           role="tabpanel" aria-labelledby="heading-32a8e000e928e6dc255876d9fc0178b3">
        
        
          
  <div class="category-post-list">
    
    
      
      
        <a href="/deng-2022/blog_2/2023/06/22/Nginx%20%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97%EF%BC%9A%E7%90%86%E8%A7%A3%E3%80%81%E9%85%8D%E7%BD%AE%E5%92%8C%E4%BC%98%E5%8C%96/" title="Nginx 入门指南：理解、配置和优化"
           class="list-group-item list-group-item-action
           active">
          <span class="category-post">Nginx 入门指南：理解、配置和优化</span>
        </a>
      
    
  </div>

        
      </div>
    </div>
  
        
      </div>
    </div>
  
</div>


  </aside>


    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Nginx 入门指南：理解、配置和优化</h1>
            
              <p class="note note-success">
                
                  
                    本文最后更新于：6 个月前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <h1 id="破冰"><a href="#破冰" class="headerlink" title="破冰"></a>破冰</h1><blockquote>
<p>🥣 推荐阅读：</p>
<ul>
<li><h5 id="67条消息-Nginx-目录结构与配置文件详解-nginx目录-不会调制解调的猫的博客-CSDN博客-（2023-12-15午）"><a href="#67条消息-Nginx-目录结构与配置文件详解-nginx目录-不会调制解调的猫的博客-CSDN博客-（2023-12-15午）" class="headerlink" title="(67条消息) Nginx - 目录结构与配置文件详解_nginx目录_不会调制解调的猫的博客-CSDN博客 （2023/12/15午）"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/Trollz/article/details/126525238">(67条消息) Nginx - 目录结构与配置文件详解_nginx目录_不会调制解调的猫的博客-CSDN博客</a> （2023/12/15午）</h5></li>
<li><h5 id="Nginx的配置文件详解-KuangStudy-文章"><a href="#Nginx的配置文件详解-KuangStudy-文章" class="headerlink" title="Nginx的配置文件详解-KuangStudy-文章"></a><a target="_blank" rel="noopener" href="https://www.kuangstudy.com/bbs/1619965646882693121">Nginx的配置文件详解-KuangStudy-文章</a></h5></li>
</ul>
</blockquote>
<h2 id="Nginx是什么"><a href="#Nginx是什么" class="headerlink" title="Nginx是什么"></a>Nginx是什么</h2><ul>
<li><h5 id="官⽅解析-："><a href="#官⽅解析-：" class="headerlink" title="官⽅解析 ："></a>官⽅解析 ：</h5></li>
</ul>
<figure class="highlight llvm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs llvm">Nginx（发⾳为“engine-<span class="hljs-keyword">x</span>”）是⼀个⾼性能的开源 Web 服务器和反向代理服务器，可以处理⼤ 量的并发连接和请求。它使⽤事件驱动的异步架构和多线程设计，可以⾼效地处理并发请求， 同时也⽀持反向代理、负载均衡、动态HTTP缓存、SSL/TLS终⽌、基于模块的扩展等功能。<br></code></pre></td></tr></table></figure>

<ul>
<li><p> Nginx 的应⽤场景⾮常⼴泛，以下是其中的⼏个：</p>
</li>
<li><p> <strong>Web 服务器：</strong>Nginx 可以作为 HTTP 服务器，处理并发的静态请求和动态请求，并且可 以⽀持负载均衡和缓存，为⽹站提供⾼性能和⾼可⽤性。 </p>
</li>
<li><p><strong>反向代理服务器：</strong>Nginx 可以作为反向代理服务器，接收客户端请求并将其转发到后端服 务器，同时也可以⽀持负载均衡和缓存。 </p>
</li>
<li><p><strong>邮件代理服务器：</strong>Nginx 可以作为邮件代理服务器，⽀持 POP3、IMAP 和 SMTP 协议， 并且可以⽀持 SSL/TLS 加密和反垃圾邮件功能。 </p>
</li>
<li><p><strong>流媒体服务器：</strong>Nginx 可以作为流媒体服务器，⽀持 RTMP、HLS 和 DASH 协议，可以 ⽤于实现直播、点播和视频-on-demand（VoD）等场景。 </p>
</li>
<li><h5 id="总之，Nginx-具有⾼性能、可扩展性和可靠性等特点，被⼴泛应⽤于⼤型⽹站、互联⽹公司、-云计算、视频流媒体、游戏等领域"><a href="#总之，Nginx-具有⾼性能、可扩展性和可靠性等特点，被⼴泛应⽤于⼤型⽹站、互联⽹公司、-云计算、视频流媒体、游戏等领域" class="headerlink" title="总之，Nginx 具有⾼性能、可扩展性和可靠性等特点，被⼴泛应⽤于⼤型⽹站、互联⽹公司、 云计算、视频流媒体、游戏等领域"></a>总之，Nginx 具有⾼性能、可扩展性和可靠性等特点，被⼴泛应⽤于⼤型⽹站、互联⽹公司、 云计算、视频流媒体、游戏等领域</h5></li>
</ul>
<h1 id="思维碰撞"><a href="#思维碰撞" class="headerlink" title="思维碰撞"></a>思维碰撞</h1><h2 id="Nginx简介和安装"><a href="#Nginx简介和安装" class="headerlink" title="Nginx简介和安装"></a>Nginx简介和安装</h2><ul>
<li><h5 id="了解-Nginx：功能、优势和应用场景"><a href="#了解-Nginx：功能、优势和应用场景" class="headerlink" title="了解 Nginx：功能、优势和应用场景"></a>了解 Nginx：功能、优势和应用场景</h5></li>
</ul>
<h3 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h3><ul>
<li><h5 id="这篇关于Nginx的介绍是我看过最详细的了：Nginx-学习-KuangStudy-文章"><a href="#这篇关于Nginx的介绍是我看过最详细的了：Nginx-学习-KuangStudy-文章" class="headerlink" title="这篇关于Nginx的介绍是我看过最详细的了：Nginx 学习-KuangStudy-文章"></a>这篇关于Nginx的介绍是我看过最详细的了：<a target="_blank" rel="noopener" href="https://www.kuangstudy.com/bbs/1483987971375263745">Nginx 学习-KuangStudy-文章</a></h5></li>
<li><h5 id="这里我就不详细展开说了，网上的资料对Nginx都有着详尽的介绍，我仅依照自己的理解，给出我对Nginx的认识："><a href="#这里我就不详细展开说了，网上的资料对Nginx都有着详尽的介绍，我仅依照自己的理解，给出我对Nginx的认识：" class="headerlink" title="这里我就不详细展开说了，网上的资料对Nginx都有着详尽的介绍，我仅依照自己的理解，给出我对Nginx的认识："></a>这里我就不详细展开说了，网上的资料对Nginx都有着详尽的介绍，我仅依照自己的理解，给出我对Nginx的认识：</h5></li>
<li><h5 id="Nginx是一个高性能的HTTP和反向代理web服务器，它的特点是负载均衡、反向代理"><a href="#Nginx是一个高性能的HTTP和反向代理web服务器，它的特点是负载均衡、反向代理" class="headerlink" title="Nginx是一个高性能的HTTP和反向代理web服务器，它的特点是负载均衡、反向代理"></a>Nginx是一个高性能的HTTP和反向代理web服务器，它的特点是负载均衡、反向代理</h5></li>
</ul>
<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><h4 id="windows安装"><a href="#windows安装" class="headerlink" title="windows安装"></a>windows安装</h4><ul>
<li><h5 id="Nginx官网下载：nginx-download"><a href="#Nginx官网下载：nginx-download" class="headerlink" title="Nginx官网下载：nginx: download"></a>Nginx官网下载：<a target="_blank" rel="noopener" href="http://nginx.org/en/download.html">nginx: download</a></h5></li>
<li><h5 id="只需在官网下载安装包，在本地解压即可"><a href="#只需在官网下载安装包，在本地解压即可" class="headerlink" title="只需在官网下载安装包，在本地解压即可"></a>只需在官网下载安装包，在本地解压即可</h5></li>
</ul>
<h4 id="本地Linux原始安装"><a href="#本地Linux原始安装" class="headerlink" title="本地Linux原始安装"></a>本地Linux原始安装</h4><ul>
<li><h5 id="手动安装并手动配置是很繁琐的，不过操作一遍确实很能巩固Linux命令，这里给出详细的安装教程："><a href="#手动安装并手动配置是很繁琐的，不过操作一遍确实很能巩固Linux命令，这里给出详细的安装教程：" class="headerlink" title="手动安装并手动配置是很繁琐的，不过操作一遍确实很能巩固Linux命令，这里给出详细的安装教程："></a>手动安装并手动配置是很繁琐的，不过操作一遍确实很能巩固Linux命令，这里给出详细的安装教程：</h5></li>
<li><h5 id="Nginx官网下载：nginx-download-1"><a href="#Nginx官网下载：nginx-download-1" class="headerlink" title="Nginx官网下载：nginx: download"></a>Nginx官网下载：<a target="_blank" rel="noopener" href="http://nginx.org/en/download.html">nginx: download</a></h5></li>
<li><h5 id="教程一：Nginx安装下载-KuangStudy-文章"><a href="#教程一：Nginx安装下载-KuangStudy-文章" class="headerlink" title="教程一：Nginx安装下载-KuangStudy-文章"></a>教程一：<a target="_blank" rel="noopener" href="https://www.kuangstudy.com/bbs/1511610238649233410">Nginx安装下载-KuangStudy-文章</a></h5></li>
<li><h5 id="教程二：-67条消息-Nginx安装及其常用命令（实操版）-nginx安装命令-叫我-默语的博客-CSDN博客"><a href="#教程二：-67条消息-Nginx安装及其常用命令（实操版）-nginx安装命令-叫我-默语的博客-CSDN博客" class="headerlink" title="教程二：(67条消息) Nginx安装及其常用命令（实操版）_nginx安装命令_叫我 默语的博客-CSDN博客"></a>教程二：<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_42055933/article/details/130734077">(67条消息) Nginx安装及其常用命令（实操版）_nginx安装命令_叫我 默语的博客-CSDN博客</a></h5></li>
<li><h5 id="教程三：-67条消息-yum安装nginx-yum-安装nginx-q495673918的博客-CSDN博客"><a href="#教程三：-67条消息-yum安装nginx-yum-安装nginx-q495673918的博客-CSDN博客" class="headerlink" title="教程三：(67条消息) yum安装nginx_yum 安装nginx_q495673918的博客-CSDN博客"></a>教程三：<a target="_blank" rel="noopener" href="https://blog.csdn.net/q495673918/article/details/124477891">(67条消息) yum安装nginx_yum 安装nginx_q495673918的博客-CSDN博客</a></h5></li>
<li><h5 id="将来有空的话，我会补充这里的手动安装实操流程（宝塔一键安装真的太便捷了）"><a href="#将来有空的话，我会补充这里的手动安装实操流程（宝塔一键安装真的太便捷了）" class="headerlink" title="将来有空的话，我会补充这里的手动安装实操流程（宝塔一键安装真的太便捷了）"></a>将来有空的话，我会补充这里的手动安装实操流程（宝塔一键安装真的太便捷了）</h5></li>
</ul>
<h4 id="宝塔Linux一键安装"><a href="#宝塔Linux一键安装" class="headerlink" title="宝塔Linux一键安装"></a>宝塔Linux一键安装</h4><ul>
<li><h5 id="不论是云服务器还是本地服务器，宝塔Linux都是一键安装的，省去了大部分繁琐的配置"><a href="#不论是云服务器还是本地服务器，宝塔Linux都是一键安装的，省去了大部分繁琐的配置" class="headerlink" title="不论是云服务器还是本地服务器，宝塔Linux都是一键安装的，省去了大部分繁琐的配置"></a>不论是云服务器还是本地服务器，宝塔Linux都是一键安装的，省去了大部分繁琐的配置</h5></li>
<li><h5 id="你可以在登录宝塔面板之后，在软件商店里下载安装："><a href="#你可以在登录宝塔面板之后，在软件商店里下载安装：" class="headerlink" title="你可以在登录宝塔面板之后，在软件商店里下载安装："></a>你可以在登录宝塔面板之后，在软件商店里下载安装：</h5></li>
</ul>
<img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230622143528026.png" alt="image-20230622143528026" style="zoom:150%;" />

<ul>
<li><h5 id="也可以在终端里，像本地Linux服务器一样，使用命令安装配置Nginx"><a href="#也可以在终端里，像本地Linux服务器一样，使用命令安装配置Nginx" class="headerlink" title="也可以在终端里，像本地Linux服务器一样，使用命令安装配置Nginx"></a>也可以在终端里，像本地Linux服务器一样，使用命令安装配置Nginx</h5></li>
</ul>
<h2 id="服务启停"><a href="#服务启停" class="headerlink" title="服务启停"></a>服务启停</h2><ul>
<li><h5 id="学会安装、启动和停止-Nginx-服务"><a href="#学会安装、启动和停止-Nginx-服务" class="headerlink" title="学会安装、启动和停止 Nginx 服务"></a>学会安装、启动和停止 Nginx 服务</h5></li>
<li><h5 id="这里补充下Nginx常用命令："><a href="#这里补充下Nginx常用命令：" class="headerlink" title="这里补充下Nginx常用命令："></a>这里补充下Nginx常用命令：</h5></li>
</ul>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">nginx</span> 					<span class="hljs-comment"># 启动Nginx </span><br></code></pre></td></tr></table></figure>

<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">nginx</span> -c filename  		<span class="hljs-comment"># 指定配置⽂件 </span><br></code></pre></td></tr></table></figure>

<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">nginx</span> -V 				<span class="hljs-comment"># 查看Nginx的版本和编译参数等信息 </span><br></code></pre></td></tr></table></figure>

<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">nginx</span> -t 				<span class="hljs-comment"># 检查配置⽂件是否正确，也可⽤来定位配置⽂件的位置 </span><br></code></pre></td></tr></table></figure>

<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli">nginx -s <span class="hljs-keyword">quit</span> 			<span class="hljs-comment"># 优雅停⽌Nginx</span><br></code></pre></td></tr></table></figure>

<figure class="highlight crmsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs crmsh">nginx -s <span class="hljs-literal">stop</span> 			<span class="hljs-comment"># 快速停⽌Nginx</span><br></code></pre></td></tr></table></figure>

<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli">nginx -s <span class="hljs-keyword">reload</span> 		<span class="hljs-comment"># 重新加载配置⽂件 </span><br></code></pre></td></tr></table></figure>

<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">nginx</span> -s reopen 		<span class="hljs-comment"># 重新打开⽇志⽂件</span><br></code></pre></td></tr></table></figure>

<h2 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a>配置文件</h2><blockquote>
<p>🔥 推荐阅读：</p>
</blockquote>
<ul>
<li><h5 id="深入理解-Nginx-配置文件：语法、块和常用指令"><a href="#深入理解-Nginx-配置文件：语法、块和常用指令" class="headerlink" title="深入理解 Nginx 配置文件：语法、块和常用指令"></a>深入理解 Nginx 配置文件：语法、块和常用指令</h5></li>
<li><h5 id="介绍下Nginx目录结构和配置文件的内容："><a href="#介绍下Nginx目录结构和配置文件的内容：" class="headerlink" title="介绍下Nginx目录结构和配置文件的内容："></a>介绍下Nginx目录结构和配置文件的内容：</h5></li>
<li><h5 id="67条消息-Nginx-目录结构与配置文件详解-nginx目录-不会调制解调的猫的博客-CSDN博客"><a href="#67条消息-Nginx-目录结构与配置文件详解-nginx目录-不会调制解调的猫的博客-CSDN博客" class="headerlink" title="(67条消息) Nginx - 目录结构与配置文件详解_nginx目录_不会调制解调的猫的博客-CSDN博客"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/Trollz/article/details/126525238">(67条消息) Nginx - 目录结构与配置文件详解_nginx目录_不会调制解调的猫的博客-CSDN博客</a></h5></li>
<li><h5 id="Nginx的配置文件详解-KuangStudy-文章-1"><a href="#Nginx的配置文件详解-KuangStudy-文章-1" class="headerlink" title="Nginx的配置文件详解-KuangStudy-文章"></a><a target="_blank" rel="noopener" href="https://www.kuangstudy.com/bbs/1619965646882693121">Nginx的配置文件详解-KuangStudy-文章</a></h5></li>
</ul>
<h2 id="反向代理和负载均衡"><a href="#反向代理和负载均衡" class="headerlink" title="反向代理和负载均衡"></a>反向代理和负载均衡</h2><ul>
<li><h5 id="Nginx-反向代理和负载均衡：有效分发流量"><a href="#Nginx-反向代理和负载均衡：有效分发流量" class="headerlink" title="Nginx 反向代理和负载均衡：有效分发流量"></a>Nginx 反向代理和负载均衡：有效分发流量</h5></li>
<li><h5 id="我们在本地的4000、5173、8080三个端口开启静态站点服务："><a href="#我们在本地的4000、5173、8080三个端口开启静态站点服务：" class="headerlink" title="我们在本地的4000、5173、8080三个端口开启静态站点服务："></a>我们在本地的4000、5173、8080三个端口开启静态站点服务：</h5></li>
</ul>
<p><img src="C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20230708095447602.png" alt="image-20230708095447602"></p>
<p><img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230708095520028.png" alt="image-20230708095520028"></p>
<p><img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230708095552638.png" alt="image-20230708095552638"></p>
<ul>
<li><h5 id="在nginx-conf文件下，分别开放8887、8888、8889端口，反向代理三个静态站点服务"><a href="#在nginx-conf文件下，分别开放8887、8888、8889端口，反向代理三个静态站点服务" class="headerlink" title="在nginx.conf文件下，分别开放8887、8888、8889端口，反向代理三个静态站点服务"></a>在nginx.conf文件下，分别开放8887、8888、8889端口，反向代理三个静态站点服务</h5></li>
<li><h5 id="详细配置如下："><a href="#详细配置如下：" class="headerlink" title="详细配置如下："></a>详细配置如下：</h5></li>
</ul>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-section">http</span> &#123;<br>    <span class="hljs-attribute">include</span>       mime.types;<br>    <span class="hljs-attribute">default_type</span>  application/json;<br><br>    <span class="hljs-attribute">sendfile</span>        <span class="hljs-literal">on</span>;<br>    <br>    <span class="hljs-attribute">keepalive_timeout</span>  <span class="hljs-number">65</span>;<br><br>    <span class="hljs-section">upstream</span> memory-blog &#123;   <br>      <span class="hljs-attribute">server</span> localhost:<span class="hljs-number">4000</span>;<br>    &#125;<br><br>    <span class="hljs-section">upstream</span> memory-docs1 &#123;   <br>      <span class="hljs-attribute">server</span> localhost:<span class="hljs-number">5173</span>;<br>    &#125;<br><br>    <span class="hljs-section">upstream</span> memory-docs2 &#123;   <br>      <span class="hljs-attribute">server</span> localhost:<span class="hljs-number">8080</span>;<br>    &#125;<br>    <br>    <span class="hljs-section">server</span> &#123;<br>        <span class="hljs-attribute">listen</span>       <span class="hljs-number">8887</span>;<br>        <span class="hljs-attribute">server_name</span>  localhost;<br>       <br>        <span class="hljs-section">location</span> / &#123;<br>            <span class="hljs-attribute">proxy_pass</span>  http://memory-blog; <br>        &#125;<br><br>        <span class="hljs-attribute">error_page</span>   <span class="hljs-number">500</span> <span class="hljs-number">502</span> <span class="hljs-number">503</span> <span class="hljs-number">504</span>  /50x.html;<br>        <span class="hljs-section">location</span> = /50x.html &#123;<br>            <span class="hljs-attribute">root</span>   html;<br>        &#125;<br>    &#125;<br><br>    <span class="hljs-section">server</span> &#123;<br>        <span class="hljs-attribute">listen</span>       <span class="hljs-number">8888</span>;<br>        <span class="hljs-attribute">server_name</span>  localhost;<br>        <br>        <span class="hljs-section">location</span> / &#123;<br>            <span class="hljs-attribute">proxy_pass</span>  http://memory-docs1; <br>        &#125;<br><br>        <span class="hljs-attribute">error_page</span>   <span class="hljs-number">500</span> <span class="hljs-number">502</span> <span class="hljs-number">503</span> <span class="hljs-number">504</span>  /50x.html;<br>        <span class="hljs-section">location</span> = /50x.html &#123;<br>            <span class="hljs-attribute">root</span>   html;<br>        &#125;<br>    &#125;<br><br><br>    <span class="hljs-section">server</span> &#123;<br>        <span class="hljs-attribute">listen</span>       <span class="hljs-number">8889</span>;<br>        <span class="hljs-attribute">server_name</span>  localhost;<br>       <br>        <span class="hljs-section">location</span> / &#123;<br>            <span class="hljs-attribute">proxy_pass</span>  http://memory-docs2; <br>        &#125;<br><br>        <span class="hljs-attribute">error_page</span>   <span class="hljs-number">500</span> <span class="hljs-number">502</span> <span class="hljs-number">503</span> <span class="hljs-number">504</span>  /50x.html;<br>        <span class="hljs-section">location</span> = /50x.html &#123;<br>            <span class="hljs-attribute">root</span>   html;<br>        &#125;<br>    &#125;<br>&#125;<br></code></pre></td></tr></table></figure>

<ul>
<li><h5 id="有关配置的详细讲解，在配置文件👆一栏中了解"><a href="#有关配置的详细讲解，在配置文件👆一栏中了解" class="headerlink" title="有关配置的详细讲解，在配置文件👆一栏中了解"></a>有关配置的详细讲解，在配置文件👆一栏中了解</h5></li>
<li><h5 id="修改完配置，我们重新加载配置文件，并启动Nginx服务"><a href="#修改完配置，我们重新加载配置文件，并启动Nginx服务" class="headerlink" title="修改完配置，我们重新加载配置文件，并启动Nginx服务"></a>修改完配置，我们重新加载配置文件，并启动Nginx服务</h5></li>
</ul>
<figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">nginx -s reload</span> <br></code></pre></td></tr></table></figure>

<figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">nginx</span><br></code></pre></td></tr></table></figure>

<ul>
<li><h5 id="分别访问本地8887、8888、8889端口："><a href="#分别访问本地8887、8888、8889端口：" class="headerlink" title="分别访问本地8887、8888、8889端口："></a>分别访问本地8887、8888、8889端口：</h5></li>
</ul>
<p><img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230708100936095.png" alt="image-20230708100936095"></p>
<p><img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230708100544510.png" alt="image-20230708100544510"></p>
<p><img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230708100612584.png" alt="image-20230708100612584"></p>
<ul>
<li><h5 id="可以看到，我们开启了Nginx服务，只需访问Nginx给我们开放的端口，就能够访问到对应服务器，获取页面数据"><a href="#可以看到，我们开启了Nginx服务，只需访问Nginx给我们开放的端口，就能够访问到对应服务器，获取页面数据" class="headerlink" title="可以看到，我们开启了Nginx服务，只需访问Nginx给我们开放的端口，就能够访问到对应服务器，获取页面数据"></a>可以看到，我们开启了Nginx服务，只需访问Nginx给我们开放的端口，就能够访问到对应服务器，获取页面数据</h5></li>
<li><h5 id="这是因为Nginx将我们的请求转发给了服务器，而用户是无感知的，这就是Nginx反向代理"><a href="#这是因为Nginx将我们的请求转发给了服务器，而用户是无感知的，这就是Nginx反向代理" class="headerlink" title="这是因为Nginx将我们的请求转发给了服务器，而用户是无感知的，这就是Nginx反向代理"></a>这是因为Nginx将我们的请求转发给了服务器，而用户是无感知的，这就是Nginx反向代理</h5></li>
</ul>
<h2 id="静态网站部署"><a href="#静态网站部署" class="headerlink" title="静态网站部署"></a>静态网站部署</h2><h2 id="HTTPS配置"><a href="#HTTPS配置" class="headerlink" title="HTTPS配置"></a>HTTPS配置</h2><ul>
<li><h5 id="使用-Nginx-配置-HTTPS：安全加密通信"><a href="#使用-Nginx-配置-HTTPS：安全加密通信" class="headerlink" title="使用 Nginx 配置 HTTPS：安全加密通信"></a>使用 Nginx 配置 HTTPS：安全加密通信</h5></li>
</ul>
<h2 id="虚拟主机"><a href="#虚拟主机" class="headerlink" title="虚拟主机"></a>虚拟主机</h2><ul>
<li><h5 id="Nginx-虚拟主机配置：多个网站共享一台服务器"><a href="#Nginx-虚拟主机配置：多个网站共享一台服务器" class="headerlink" title="Nginx 虚拟主机配置：多个网站共享一台服务器"></a>Nginx 虚拟主机配置：多个网站共享一台服务器</h5></li>
</ul>
<h2 id="踩坑经历"><a href="#踩坑经历" class="headerlink" title="踩坑经历"></a>踩坑经历</h2><h3 id="访问Nginx403错误"><a href="#访问Nginx403错误" class="headerlink" title="访问Nginx403错误"></a>访问Nginx403错误</h3><ul>
<li><h5 id="运维排查篇-访问nginx出现403错误-知乎-zhihu-com"><a href="#运维排查篇-访问nginx出现403错误-知乎-zhihu-com" class="headerlink" title="运维排查篇 | 访问nginx出现403错误 - 知乎 (zhihu.com)"></a><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/381967653">运维排查篇 | 访问nginx出现403错误 - 知乎 (zhihu.com)</a></h5></li>
<li><h5 id="详解Nginx出现403Forbidden的解决办法-第一PHP社区-php1-cn"><a href="#详解Nginx出现403Forbidden的解决办法-第一PHP社区-php1-cn" class="headerlink" title="详解Nginx出现403Forbidden的解决办法 - 第一PHP社区 (php1.cn)"></a><a target="_blank" rel="noopener" href="https://www.php1.cn/detail/XiangJie_Nginx_C_5d37dae4.html">详解Nginx出现403Forbidden的解决办法 - 第一PHP社区 (php1.cn)</a></h5></li>
<li><h5 id="四种解决Nginx出现403-forbidden-报错的方法-baidu-com"><a href="#四种解决Nginx出现403-forbidden-报错的方法-baidu-com" class="headerlink" title="四种解决Nginx出现403 forbidden 报错的方法 (baidu.com)"></a><a target="_blank" rel="noopener" href="https://baijiahao.baidu.com/s?id=1614533633678689239&wfr=spider&for=pc">四种解决Nginx出现403 forbidden 报错的方法 (baidu.com)</a></h5></li>
<li><h5 id="先是看了很多解决办法（以上），虽然没有解决，但丰富了我对Nginx配置的理解"><a href="#先是看了很多解决办法（以上），虽然没有解决，但丰富了我对Nginx配置的理解" class="headerlink" title="先是看了很多解决办法（以上），虽然没有解决，但丰富了我对Nginx配置的理解"></a>先是看了很多解决办法（以上），虽然没有解决，但丰富了我对Nginx配置的理解</h5></li>
<li><h5 id="然后我想到看错误日志，但查看配置发现默认没开启，那就开启错误日志："><a href="#然后我想到看错误日志，但查看配置发现默认没开启，那就开启错误日志：" class="headerlink" title="然后我想到看错误日志，但查看配置发现默认没开启，那就开启错误日志："></a>然后我想到看错误日志，但查看配置发现默认没开启，那就开启错误日志：</h5></li>
<li><h5 id="错误日志路径："><a href="#错误日志路径：" class="headerlink" title="错误日志路径："></a>错误日志路径：</h5></li>
</ul>
<img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230622154436897.png" style="zoom:67%;" />

<ul>
<li><h5 id="开启错误日志："><a href="#开启错误日志：" class="headerlink" title="开启错误日志："></a>开启错误日志：</h5></li>
</ul>
<img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230622154707468.png" alt="image-20230622154707468" style="zoom: 80%;" />

<ul>
<li><h5 id="查看错误日志，发现问题所在："><a href="#查看错误日志，发现问题所在：" class="headerlink" title="查看错误日志，发现问题所在："></a>查看错误日志，发现问题所在：</h5></li>
</ul>
<img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230622154920109.png" alt="image-20230622154920109" style="zoom:150%;" />

<ul>
<li><h5 id="接着看这个解决思路：-67条消息-报错：directory-index-of-“xxx“-is-forbidden-directory-index-of-is-forbidden-AI人工智能与大数据的博客-CSDN博客"><a href="#接着看这个解决思路：-67条消息-报错：directory-index-of-“xxx“-is-forbidden-directory-index-of-is-forbidden-AI人工智能与大数据的博客-CSDN博客" class="headerlink" title="接着看这个解决思路：(67条消息) 报错：directory index of “xxx“ is forbidden_directory index of is forbidden_AI人工智能与大数据的博客-CSDN博客"></a>接着看这个解决思路：<a target="_blank" rel="noopener" href="https://blog.csdn.net/guanxs/article/details/107901101">(67条消息) 报错：directory index of “xxx“ is forbidden_directory index of is forbidden_AI人工智能与大数据的博客-CSDN博客</a></h5></li>
<li><h5 id="添加这行配置："><a href="#添加这行配置：" class="headerlink" title="添加这行配置："></a>添加这行配置：</h5></li>
</ul>
<img src="https://gitee.com/deng-2022/pictures/raw/master/images/image-20230622155144376.png" alt="image-20230622155144376" style="zoom: 80%;" />

<ul>
<li><h5 id="然后访问Nginx（记得nginx-s-reload），访问成功，大功告成"><a href="#然后访问Nginx（记得nginx-s-reload），访问成功，大功告成" class="headerlink" title="然后访问Nginx（记得nginx -s reload），访问成功，大功告成"></a>然后访问Nginx（记得nginx -s reload），访问成功，大功告成</h5></li>
<li><h5 id="这就是访问Nginx发生403错误的具体解决办法了，很有收获"><a href="#这就是访问Nginx发生403错误的具体解决办法了，很有收获" class="headerlink" title="这就是访问Nginx发生403错误的具体解决办法了，很有收获"></a>这就是访问Nginx发生403错误的具体解决办法了，很有收获</h5></li>
</ul>
<h1 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h1>
                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/deng-2022/blog_2/categories/Nginx/" class="category-chain-item">Nginx</a>
  
  
    <span>></span>
    
  <a href="/deng-2022/blog_2/categories/Nginx/%E7%BB%8F%E9%AA%8C/" class="category-chain-item">经验</a>
  
  

  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/deng-2022/blog_2/tags/%E7%BB%8F%E9%AA%8C/">#经验</a>
      
        <a href="/deng-2022/blog_2/tags/Nginx/">#Nginx</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Nginx 入门指南：理解、配置和优化</div>
      <div>https://atomgit.com/deng-2022/blog_2/2023/06/22/Nginx 入门指南：理解、配置和优化/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Memory</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年6月22日</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>更新于</div>
          <div>2023年12月15日</div>
        </div>
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/deng-2022/blog_2/2023/06/22/AI%20%E5%AE%9E%E8%B7%B5%E4%B8%AD%E7%9A%84%E6%B4%9E%E8%A7%81%EF%BC%9A%E6%88%91%E7%9A%84%20AI%20%E4%B9%8B%E6%97%85/" title="AI实践中的洞见：我的AI之旅">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">AI实践中的洞见：我的AI之旅</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/deng-2022/blog_2/2023/06/20/Typora%E6%93%8D%E4%BD%9C%E6%8A%80%E5%B7%A7/" title="美轮美奂的文档艺术：Typora的使用技巧和实践">
                        <span class="hidden-mobile">美轮美奂的文档艺术：Typora的使用技巧和实践</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments">
      

    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.fluid-dev.com/docs/guide/" target="_blank" rel="nofollow noopener"> <span>Memory | 个人文档站点</span> </a>
<i class="iconfont icon-love"></i> <a href="https://hexo.fluid-dev.com/docs/guide/" target="_blank" rel="nofollow noopener"> <span>配置指南 | Hexo Fluid 用户手册</span> </a>   
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="leancloud-site-pv-container" style="display: none">
        总访问量 
        <span id="leancloud-site-pv"></span>
         次
      </span>
    
    
      <span id="leancloud-site-uv-container" style="display: none">
        总访客数 
        <span id="leancloud-site-uv"></span>
         人
      </span>
    
    

  
</div>

  
  
    <!-- 备案信息 ICP for China -->
    <div class="beian">
  <span>
    <a href="http://beian.miit.gov.cn/" target="_blank" rel="nofollow noopener">
      京ICP证123456号
    </a>
  </span>
  
    
      <span>
        <a
          href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=12345678"
          rel="nofollow noopener"
          class="beian-police"
          target="_blank"
        >
          
            <span style="visibility: hidden; width: 0">|</span>
            <img src="/deng-2022/blog_2/img/police_beian.png" alt="police-icon"/>
          
          <span>京公网安备12345678号</span>
        </a>
      </span>
    
  
</div>

  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/deng-2022/blog_2/js/events.js" ></script>
<script  src="/deng-2022/blog_2/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>







  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/deng-2022/blog_2/js/local-search.js" ></script>

  <script defer src="/deng-2022/blog_2/js/leancloud.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/deng-2022/blog_2/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
